Bitwise Left Shift (<<) Operator in Java
Java
/*package whatever //do not write package name here */ import java.io.*; class GFG { public static void main(String[] args) { int x = 5 ; int y = x << 2 ; System.out.println( "Value of x after left shift by 2 positions: " + y); } } |
Output
Value of x after left shift by 2 positions: 20
Bitwise Left Shift(<<) Operator in Programming
Bitwise operators play a significant role in manipulating individual bits within binary data. Among these operators, the Bitwise Left Shift (<<) operator is used for shifting the bits of a number to the left by a specified number of positions. In this blog post, we’ll explore the definition, syntax, examples, and optimization techniques associated with the bitwise left shift operator.
Table of Content
- What is Bitwise Left Shift (<<) Operator
- Bitwise Left Shift (<<) Operator Syntax
- Bitwise Left Shift (<<) Operator in C
- Bitwise Left Shift (<<) Operator in C++
- Bitwise Left Shift (<<) Operator in Java
- Bitwise Left Shift (<<) Operator in Python
- Bitwise Left Shift (<<) Operator in C#
- Bitwise Left Shift (<<) Operator in Javascript
- Bitwise Left Shift (<<) Operator Use Cases
Contact Us